<?php

class Application_Form_QuestionAdd extends Zend_Form
{

    public function init()
    {
        $this->setName('questionadd');
        $this->setMethod('POST');
        
        $qenname = new Zend_Form_Element_Text('qenname');
        $qenname ->setLabel('题目英文名')
                ->setRequired(true)
                ->setAttrib('MaxLength', '32')
                ->setAttrib('class','border')
                ->setAttrib('onkeyup',"value=value.replace(/[^\w\.\/=()&+-]/ig,'')")
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
                
        $qchname = new Zend_Form_Element_Text('qchname');
        $qchname ->setLabel('题目中文名')
                ->setRequired(true)
                ->setAttrib('MaxLength', '32')
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        
        $qscore = new Zend_Form_Element_Text('qscore');
        $qscore ->setLabel('题目得分')
                ->setRequired(true)
                ->setAttrib('MaxLength', '2')
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->addValidator('Digits');
        
        $qinput = new Zend_Form_Element_Textarea('qinput');
        $qinput ->setLabel('默认输入')
                ->setAttrib('class','border')
                ->setAttrib('rows','7')
                ->setAttrib('cols','70')
                ->setRequired(true)
                ->addValidator('NotEmpty');
        
        $qoutput = new Zend_Form_Element_Textarea('qoutput');
        $qoutput ->setLabel('默认输出')
                ->setAttrib('class','border')
                ->setAttrib('rows','7')
                ->setAttrib('cols','70')
                ->setRequired(true)
                ->addValidator('NotEmpty');
        
        $requiretime = new Zend_Form_Element_Text('requiretime');
        $requiretime ->setLabel('时间限制(单位:ms)')
                ->setRequired(true)
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->addValidator('Digits');
        
        $requiremem = new Zend_Form_Element_Text('requiremem');
        $requiremem ->setLabel('内存限制(单位:KB)')
                ->setRequired(true)
                ->setAttrib('class','border')
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty')
                ->addValidator('Digits');
        
        $encontent = new Zend_Form_Element_Textarea('encontent');
        $encontent ->setLabel('题目内容(英文)')
                ->setRequired(true)
                ->setAttrib('rows','7')
                ->setAttrib('class','border')
                ->setAttrib('cols','70')
                ->setAttrib('onkeyup',"value=value.replace(/[^\w\.\/=()&+-]/ig,'')")
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        
        $chcontent = new Zend_Form_Element_Textarea('chcontent');
        $chcontent ->setLabel('题目内容(中文)')
                ->setRequired(true)
                ->setAttrib('rows','7')
                ->setAttrib('class','border')
                ->setAttrib('cols','70')
                ->addFilter('StripTags')
                ->addFilter('StringTrim');
        
        $qaddsubmit = $this->createElement('submit','add',array(
            'label'=>'确认提交',
            'id'=>'qaddsubmit',
            'class'=>'submit'
        ));
        
        $this->addElements(array(
            $qchname,
            $qenname,
            $qscore,
            $requiretime,
            $requiremem,
            $qinput,
            $qoutput,
            $chcontent,
            $encontent,
            $qaddsubmit));
    }


}

